<template>
  <div class="main">
    <mine-title>新建预测</mine-title>
    <div class="content">
      <!-- 文本区域 -->
      <div v-if="modelType == 'txt_classify' || modelType == 'data_predict'">
        <text-forcast :id="modelId"></text-forcast>
      </div>

      <!-- 图片区域 -->
      <div
        v-if="
          modelType == 'img_classify' ||
          modelType == 'voice_classify' ||
          modelType == 'other' ||
          modelType == 'img_detection'
        "
      >
        <img-forcast :modelType="modelType" :id="modelId"></img-forcast>
      </div>
    </div>
  </div>
</template>

<script>
import ImgForcast from "./components/imgForcast.vue";
import textForcast from "./components/textForcast.vue";
export default {
  components: { textForcast, ImgForcast },

  mounted: function () {
    // 设置面包屑导航
    this.$store.commit("SET_BREADCRUMB", [
      { title: "前沿算法诊断", path: "/model/list" },
      { title: "模型详情", path: `/model/detail?id=${this.id}` },
      { title: "新建预测", path: "" },
    ]);
    this.getQuery();
  },

  computed: {
    id() {
      return this.$route.query.id || "";
    },
  },

  data: function () {
    return {
      modelType: "", // 模型类型
      modelId: "", // 模型id
    };
  },

  methods: {
    // 获取页面参数
    getQuery: function () {
      this.modelType = this.$route.query.type;
      this.modelId = this.$route.query.id;
    },
  },
};
</script>
